package cc.lzmsh.service.impl;

import cc.lzmsh.constants.SystemConstants;
import cc.lzmsh.domain.entity.Link;
import cc.lzmsh.domain.result.Result;
import cc.lzmsh.domain.vo.LinkVo;
import cc.lzmsh.mapper.LinkMapper;
import cc.lzmsh.service.LinkService;
import cc.lzmsh.utils.BeanCopyUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * 友链(Link)表服务实现类
 *
 * @author msh
 * @since 2024-09-15 17:50:45
 */
@Service("linkService")
public class LinkServiceImpl extends ServiceImpl<LinkMapper, Link> implements LinkService {

    @Override
    public Result<List<LinkVo>> getAllLink() {
        QueryWrapper<Link> wrapper = new QueryWrapper<>();
        wrapper.eq("status", SystemConstants.LINK_STATUS_NORMAL);
        List<Link> list = list(wrapper);
        List<LinkVo> linkVos = BeanCopyUtils.copyBeanList(list, LinkVo.class);
        return Result.success(linkVos);
    }
}

